/**
 * Created by trisatria on 3/6/14.
 */

$(document).on('change','#email', function(){
    var email = $("#email").val();
    $.ajax({
        url: _host + 'register/validate',
        type: 'POST',
        data: {  email:email }
    }).done(function(data){

        $.mobile.loading('hide');
        if(data){

        }

    });
});
$(document).on('pageshow','#signup', function(){

});

$(document).on('click','#btn_avatar',function(){
    $('#profile #popupavaatar').popup('open');
});

/*
$(document).on('click','#btn-add-profile',function(){

    var formData = $("#signupsss").serialize();
    alert('sdadasd');
    $.ajax({
        type: "POST",
        url: _host + 'user/addprofile',
        cache: false,
        data: formData

    }).done(function(data){
        console.log(data);
        $.removeCookie("logged");
        $.cookie("logged",data);
        $.mobile.loading('hide');
        alert('Đăng ký thành công');
    });
    return false;
});
*/
/*
$(document).on('submit','#signupsss', function(){
    $.mobile.loading('show');
    var email =  $('#email').val();
    var avatar =  $('.thumb_border img').attr('src');
    var name =    $('#signup #name').val();
    var pass =  $('#signup #password').val();
    var re_pass =  $('#signup #re_password').val();
    var add = $('#signup #add').val();
    var phone = $('#signup #phone').val();
    if(pass != re_pass){
        return false;
    }
    $.ajax({
        url: _host + 'user/addprofile',
        type: 'POST',
        data: {  name: name, password: pass, address: add, phone: phone, avatar: avatar, email: email }
    }).done(function(data){
        console.log(data);
        $.removeCookie("logged");
        $.cookie("logged",data);
        $.mobile.loading('hide');
        alert('Đăng ký thành công');
    });
    return false;
});*/